package com.chixing.controller;

import com.chixing.commons.ServerResponse;
import com.chixing.pojo.CompanyDetail;
import com.chixing.pojo.ExperienceProject;
import com.chixing.pojo.InternshipExperience;
import com.chixing.pojo.Myresume;
import com.chixing.service.IInternshipExperienceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

/**
 * <p>
 * 实习经历表 前端控制器
 * </p>
 *
 * @author Jason Marslyon
 * @since 2022-10-04
 */
@RestController
public class InternshipExperienceController {
    @Autowired
    private IInternshipExperienceService service;

    //    通过mresumeId获取InternshipExperience表信息，并返回
    @RequestMapping("/getInternshipByreId")
    public ServerResponse getInternshipByreId(@RequestParam("internshipId") Integer internshipId) {
        InternshipExperience internshipExperience = service.getInternshipById(internshipId);
        return ServerResponse.success("查询实习表成功", internshipExperience);
    }

    //    通过mresumeId获取CompanyDetail表信息，并返回
    @RequestMapping("/getCompanyById")
    public ServerResponse getCompanyById(@RequestParam("companyId") Integer companyId) {
        CompanyDetail companyDetail = service.getCompanyById(companyId);
        return ServerResponse.success("查询公司表成功", companyDetail);
    }

    //    修改实习经历表
    @RequestMapping("updateInternship/{internshipId}")
    public ServerResponse updateInternship(InternshipExperience internshipExperience, @PathVariable("internshipId") Integer internshipId){
        System.out.println("=================="+internshipId);
        System.out.println(internshipExperience);
        ServerResponse serverResponse = service.updateInternshipById(internshipExperience,internshipId);
        return serverResponse;
    }


}
